USE [BMIG_Mensual_POST_CADENA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_M0003_IMPUESTO]    Script Date: 11/28/2011 12:12:16 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WASP_M0003_IMPUESTO]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[WASP_M0003_IMPUESTO]
GO

USE [BMIG_Mensual_POST_CADENA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_M0003_IMPUESTO]    Script Date: 11/28/2011 12:12:16 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[WASP_M0003_IMPUESTO]
AS

BEGIN
	SELECT  ppsuc       as suc,
		   ppcta       as cta,
		   ppoper      as ope,
		   sum(ppicap) as impuesto

	INTO
		dbo.prima_comision_impuesto 

	FROM fsd601 (nolock)

	WHERE d601co = 'S' 

	GROUP BY ppsuc, ppcta, ppoper

	HAVING sum(ppicap) <> 0   

END
GO

